﻿import { ref } from 'vue';
import { defineStore } from 'pinia';
import { getStore, setStore } from '@/utils/utils';

const langs: any = {
    'en-US': 'EN',
    'zh-CN': 'ZH',
};

export const useLangStore = defineStore('lang', () => {
    const lang = ref(langs[getStore('mmk_lang')] || 'EN');
    const setLang = (val: string) => {
        setStore('mmk_lang', val);
        lang.value = langs[val];
    };

    return { lang, setLang };
});
